import { VerticalBox, HorizontalBox,Button,StandardTableView } from "std-widgets.slint";


export component MainWindow inherits Window {
    preferred-width: 1024px;
    preferred-height: 600px;

    in property <[[StandardListViewItem]]> files;

    // Menu bar
    MenuBar {
        Menu {
            title: @tr("File");
            MenuItem {
                title: @tr("New");
                activated => {
                }
            }

            MenuItem {
                title: @tr("Open");
                activated => {
                }
            }
        }

        Menu {
            title: @tr("Edit");
            MenuItem {
                title: @tr("Copy");
            }

            MenuItem {
                title: @tr("Paste");
            }

            MenuSeparator { }

            Menu {
                title: @tr("Find");
                MenuItem {
                    title: @tr("Find in document...");
                }

                MenuItem {
                    title: @tr("Find Next");
                }

                MenuItem {
                    title: @tr("Find Previous");
                }
            }
        }
    }

    // 主区域
    VerticalBox {
        // 导航栏
        HorizontalBox {
            height: 50px;
            Button {
                width: 30px;
                text: "⬅️";
            }

            Button {
                width: 30px;
                text: "➡️";
            }

            Button {
                width: 30px;
                text: "⭕️";
            }

            Rectangle {
                border-radius: 5px;
                border-color: #000;
                border-width: 1px;
                horizontal-stretch: 1;
                Text {

                    width: parent.width - 10px;
                    text: "s3://my-bucket/documents/";
                    vertical-alignment: center;
                }
            }

            Button {
                text: "上传";
                clicked => {
                }
            }

            Button {
                text: "新建文件夹";
            }
        }

        // 分割线
        Rectangle {
            height: 1px;
            background: #000;
        }

        // 文件列表
        StandardTableView {
            width: 100%;
            columns: [
                { title: "名称" },
                { title: "大小" },
                { title: "修改日期" },
                { title: "类型" },
            ];
            rows: files;
            current-row-changed(index) => {
                debug("Current row: ", index);
            }
        }
    }
}
